package cate.game.role.pay.trademall;

import cate.game.role.Role;
import cate.game.role.RoleDependent;
import cate.game.role.pay.trademall.currencyshop.CurrencyShopPO;
import cate.game.role.pay.trademall.forevercontract.ForeverContract;
import cate.game.role.pay.trademall.masterprivilege.RolePrivilegeMall;
import cate.game.role.pay.trademall.monthcard.MonthCardPO;
import cate.game.role.pay.trademall.oncefund.OnceFundAllPO;
import cate.game.role.pay.trademall.vipprivilege.VipPrivilege;
import easy.java.dev.note.NoteClass;
import easy.java.dev.note.NoteField;

@NoteClass(value = "交易坊")
public class TradeMallPO extends RoleDependent {
    @NoteField(value = "一次性基金组")
    public OnceFundAllPO once_fund_all;
    @NoteField(value = "月卡")
    public MonthCardPO monthCard;
    @NoteField(value = "特权")
    public RolePrivilegeMall privilegeMall;
    @NoteField(value = "永久契约特权")
    public ForeverContract foreverContract;
    @NoteField(value = "vip特权")
    public VipPrivilege vipPrivilege;
    @NoteField(value = "货币商铺")
    public CurrencyShopPO currency_shop;

    @Override
    public void initialize(Role role) {
        super.initialize(role);
        // 一次性基金
        if (once_fund_all == null) {
            once_fund_all = new OnceFundAllPO();
        }
        once_fund_all.initialize(role);
        // 月卡
        if (monthCard == null) {
            monthCard = new MonthCardPO();
        }
        monthCard.initialize(role);
        if (privilegeMall == null) {
            privilegeMall = new RolePrivilegeMall();
        }
        privilegeMall.initialize(role);
        if (foreverContract == null) {
            foreverContract = new ForeverContract();
        }
        foreverContract.initialize(role);
        // VIP特权
        if(vipPrivilege == null){
            vipPrivilege = new VipPrivilege();
        }
        vipPrivilege.initialize(role);
        // 货币商铺
        if (currency_shop == null) {
            currency_shop = new CurrencyShopPO();
        }
        currency_shop.initialize(role);
    }


    @Override
    public void onDaySpan(boolean silence) {
        super.onDaySpan(silence);
        if (!silence) {
        }
        monthCard.onDaySpan(silence);
        privilegeMall.onDaySpan(silence);
        foreverContract.onDaySpanSafe(silence);
        vipPrivilege.onDaySpan(silence);
        currency_shop.onDaySpan(silence);
    }

    @Override
    public void onWeekSpan(boolean silence) {
        super.onWeekSpan(silence);
        if (!silence) {
        }
    }

    @Override
    public void onMonthSpan(boolean silence) {
        super.onMonthSpan(silence);
    }


    /**
     * 发送角色初始化信息
     */
    public void sendInitInfos() {
        once_fund_all.noticeUpdate();
        monthCard.noticeUpdate();
        foreverContract.noticeUpdate();
        vipPrivilege.noticeUpdate();
        privilegeMall.noticeUpdate();
        currency_shop.sendExchangeTokenInfo();
    }
}
